<template>

  <div>
    <textarea class="content" v-model="fknr"></textarea>
    <el-row>
      <el-button @click="getfeedback" class="button" type="success" icon="el-icon-check" circle></el-button>
    </el-row>
  </div>

</template>
<script>
  import {feedback} from '@/api/user'
    export default {
        name: "index",
      data() {
        return {
          fknr: '',
        }
      },
      methods: {
        open(tips) {
          if (tips == 1) {
            this.$alert('<strong> 反 馈 提 交 成 功 。 </strong>', '成功！', {
              dangerouslyUseHTMLString: true
            })
          }else if (tips == 2){
            this.$alert('<strong> 反 馈 提 交 失 败 。 </strong>', '失败', {
              dangerouslyUseHTMLString: true
            })
          }else {
            this.$alert('<strong> 请 填 写 反 馈 信 息 。 </strong>', '操作错误', {
              dangerouslyUseHTMLString: true
            })
          }
        },
          getfeedback() {
            if (this.fknr) {
              feedback(this.fknr).then(res => {
                this.open(1)
                this.fknr = ''
                console.log(res, '打印成功提交反馈的信息')
              }).catch(err => {
                this.open(2)
                console.log(err, '打印提失败信息')
              })
            }else {
              this.open()
            }
          }
      }

    }
</script>

<style scoped>
  .content{
    width: 750px;
    height: 400px;
    border-radius: 5px;
    margin: 50px 275px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
  }
  .button{
    width: 45px;
    height: 50px;
    margin-left: 990px;
  }

</style>
